package com.haruhi.service.impl;

import com.haruhi.entity.UploadingFile;
import com.haruhi.mapper.UploadingFileMapper;
import com.haruhi.service.UploadingFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UploadingFileServiceImpl implements UploadingFileService {

    @Autowired
    private UploadingFileMapper uploadingFileMapper;
    @Override
    public int insert(UploadingFile uploadingFile) {
        return uploadingFileMapper.insert(uploadingFile);
    }

    @Override
    public List<UploadingFile> getByCondition(UploadingFile uploadingFile) {
        return uploadingFileMapper.getByCondition(uploadingFile);
    }

    @Override
    public int deleteByMD5(String md5,boolean isDel) {
        return uploadingFileMapper.deleteByMD5(md5,isDel);
    }

    @Override
    public int updateChunkByMD5(UploadingFile uploadingFile, UploadingFile condition) {
        uploadingFile.setMd5(null);
        return uploadingFileMapper.updateByCondition(uploadingFile,condition);
    }
}
